package com.lft.com.oilgas.controller;


import com.lft.com.oilgas.entity.Ordere;
import com.lft.com.oilgas.service.IOrdereService;
import com.lft.com.oilgas.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tyqw
 * @since 2024-09-10
 */
@RestController
@CrossOrigin
@RestControllerAdvice
@RequestMapping("/util/ordere")
public class OrdereController {
    //处理异常
    @ExceptionHandler(Exception.class)
    private Result yichang(Exception e){
        //noinspection CallToPrintStackTrace
        e.printStackTrace();
        return new Result(false,"服务器异常，请稍后重试");
    }
    @Autowired
    private IOrdereService iOrdereService;

    @RequestMapping("/hexiao")
    private Result hexiao(@RequestBody Map map){
        iOrdereService.hexiao(map);
        return new Result(true,null);
    }

    @RequestMapping("/hxhodan/{id}")
    private  Result shangjiaxg(@PathVariable("id") Integer id){
        List<Ordere> selecthxdan = iOrdereService.selecthxdan(id);
        return new Result(true, selecthxdan);
    }
}
